import { defineStore } from 'pinia';
import { deviceDetection } from '@/utils';
import { appStoreTyes } from './types';

export const useAppStore = defineStore('appStore', {
  state: (): appStoreTyes => ({
    device: deviceDetection() ? 'mobile' : 'desktop',
  }),

  actions: {
    toggleDevice(device: 'mobile' | 'desktop') {
      this.device !== device && (this.device = device);
    },
  },
});
